(function () {

    var huan = document.getElementById('huan');
    var ma = document.getElementById('yanzhengm');

    huan.onclick = function () {
        var arr ='';
        for (let i = 0; i < 4; i++) {
            arr += random(0, 9)
        }
        ma.innerText = arr;
    }
    huan.onclick()
    function random(a, b) {
        return Math.ceil(Math.random()*(b-a+1)+a-1);   
    }



    var guding = document.getElementById('guding')
    guding.onmouseover = function () {
        guding.style.backgroundPosition = '-56px -46px'
    }
    guding.onmouseout = function () {
        guding.style.backgroundPosition = '0 -46px'
    }

    var shenfen = document.getElementsByClassName('shenfen');
    shenfen[0].style.display = 'block'
    var tijoa = document.getElementsByClassName('tijoa');
    for (let i = 0; i < shenfen.length; i++) {
        tijoa[i].onclick = function () {
            if (i === shenfen.length - 1) {
                location.href = './../../login/登录.html'
            }
            shenfen[i].style.display = 'none'
            shenfen[i + 1].style.display = 'block'
            
        }
        
    }

    var huoqu = document.getElementById('huoqu')
    var flag = true;
    huoqu.onclick = function () {
        if (flag) {
            flag = false
            let i = 60
            huoqu.innerHTML = i;
            var timer = setInterval(function () {
                i--;
                huoqu.innerHTML = i;
                if (i === 0) {
                    clearInterval(timer);
                    huoqu.innerHTML = "获取验证码"
                    flag = true;
                    return
                }
                    
            },1000)
        }
    }
})()